package com.exam.zhaohang;

import java.util.ArrayList;
import java.util.Scanner;

/**
 * date:
 * description:
 */
public class Solution102 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        ArrayList<int[]> moves = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int x = scanner.nextInt() + 1;
            int y = scanner.nextInt() + 1;
            moves.add(new int[]{x, y});
            int res = dfs(moves);
            System.out.println(res);
        }
    }

    public static int dfs(ArrayList<int[]> moves){
        boolean[][] board = new boolean[1001][1001];
        int[][] counter = new int[1001][1001];
        for (int[] move : moves) {
            int x = move[0];
            int y = move[1];
            board[x][y] = true;
            counter[x - 1][y]++;
            counter[x + 1][y]++;
            counter[x][y - 1]++;
            counter[x][y + 1]++;
        }
        int count = 0;
        while(moves.size() > 0) {
            ArrayList<int[]> nextMoves = new ArrayList<>();
            for (int[] move : moves) {
                int x = move[0];
                int y = move[1];
                if(counter[x][y] == 3){
                    count++;
                    if(!board[x - 1][y]){
                        x--;
                    }else if(!board[x + 1][y]){
                        x++;
                    }else if(!board[x][y - 1]){
                        y--;
                    }else{
                        y++;
                    }
                    if(x > 0 && x < 1002 && y > 0 && y < 1002){
                        nextMoves.add(new int[]{x, y});
                    }
                    board[x][y] = true;
                    if(x > 0){
                        counter[x - 1][y]++;
                    }
                    if(x < 1002){
                        counter[x + 1][y]++;
                    }
                    if(y > 0){
                        counter[x][y - 1]++;
                    }
                    if(y < 1002){
                        counter[x][y + 1]++;
                    }
                }
            }
            moves = nextMoves;
        }
        return count;
    }
}
